{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
}}

<PageHeader as |p|>
  <p.top>
    <Page::Breadcrumbs @breadcrumbs={{@breadcrumbs}} />
  </p.top>
  <p.levelLeft>
    <h1 class="title is-3" data-test-header-title>
      Automatic Tidy Configuration
    </h1>
  </p.levelLeft>
</PageHeader>

<Toolbar>
  <ToolbarActions>
    <LinkTo @route="tidy.auto.configure" @model={{@model.id}} class="toolbar-link" data-test-pki-edit-tidy-auto-link>
      Edit auto-tidy
      <Icon @name="chevron-right" />
    </LinkTo>
  </ToolbarActions>
</Toolbar>

<main>
  {{#each @model.allGroups as |group|}}
    {{#each-in group as |label fields|}}
      {{#if (not-eq label "autoTidy")}}
        <h2 class="title is-5 has-top-margin-l has-bottom-margin-xs" data-test-group-title={{label}}>
          {{label}}
        </h2>
      {{/if}}

      {{#each fields as |attr|}}
        <InfoTableRow
          @label={{or attr.options.detailsLabel attr.options.label (humanize (dasherize attr.name))}}
          @value={{get @model attr.name}}
          @formatTtl={{attr.options.formatTtl}}
          data-test-row={{attr.name}}
        />
      {{/each}}
    {{/each-in}}
  {{/each}}
</main>